const autoprefixer = require('autoprefixer')
const devServer = {
  disableHostCheck: true,
  proxy: {
      '/api': {
          target: 'https://fb666.top',
          changeOrigin: true,
          pathRewrite: {
              '^/api': 'https://fb666.top'
          }
      }
  }
}

const moduleConfig = {
  lintOnSave: false,
  publicPath: process.env.NODE_ENV === 'production' ? '/h5/' : '/',
  css: {
    loaderOptions: {
      postcss: {
        plugins: () => [
          autoprefixer(),
          require('postcss-pxtorem')({
            rootValue({ file }) {
              return (file.indexOf('vant') !== -1) ? 37.5 : ((file.indexOf('element') !== -1) ? 60 : 75)
            },
            propList: ["*"]
          }),
        ]
      }
    }
  },
  productionSourceMap: false
}

if(process.env.NODE_ENV !== 'production') {
  moduleConfig.devServer = devServer
}
module.exports = moduleConfig;